<?php

namespace app\admin\service\statistics\promotion\total;

use app\admin\service\statistics\promotion\AbstractComputeStatistician;
use app\admin\service\statistics\traits\CompletionTrait;

/**
 * 渠道数据 总计 未注册UV
 * Class LoginRegisterRate
 * @package app\admin\service\statistics\promotion\total
 */
class UvUnRegister extends AbstractComputeStatistician
{
    // 补齐
    use CompletionTrait;

    // new_member_count,captcha_count
    protected function compute(int $index)
    {
        $statisticians = $this->statisticians;

        $uv = $statisticians['total-uv'][$index]['value'] ?? null;

        $new_member_count = $statisticians['total-new_member_count'][$index]['value'] ?? null;

        if (!is_numeric($uv) || !is_numeric($new_member_count)) {
            return '';
        }

        return $uv - $new_member_count;
    }

    protected function getDefaultValue()
    {
        return '0';
    }
}